﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Collections.Specialized;
using NSoup.Nodes;
using System.Collections;
using Com.Toook.AutoDownloadHtml.Entity;
using Com.Toook.AutoDownloadHtml.Util;

namespace Com.Toook.AutoDownloadHtml.DownloadHtml.NewsHtml
{
    /// <summary>
    /// 搜狐体育
    /// </summary>
    public class SohuSport : CommonSohuMethod
    {
        public SohuSport()
        {
            this.urlCategory = "http://sports.sohu.com/";
        }
        public SohuSport(string url) : base(url)
        {
        }
        public SohuSport(string url, string charset)
            : base(url, charset)
        {
        }
        /// <summary>
        /// 获取每个分类页面中的新闻url列表(如国内新闻中的每条新闻url)
        /// 保存结果到this.sdNewsUrls 字典StringDictionary
        /// </summary>       
        protected override void GetNewsUrls()
        {
            string hrefStart = "http://sports.sohu.com/" + DateTime.Now.ToString("yyyyMMdd");
            this.sdNewsUrls = new StringDictionary();

            NSoup.Select.Elements divs = docCategory.GetElementsByClass("list14");
            foreach(NSoup.Nodes.Element div in divs)
            {
                NSoup.Select.Elements links = div.GetElementsByTag("a");
                base.AddLinksToStringDictionary(links, hrefStart);
            }      
        }
        /// <summary>
        /// 获取分类中的每个新闻内容
        /// </summary>       
        protected override void GetEachNewsAndSave()
        {
            base.CommonGetEachNewsAndSave("SportSohu");
        }
    }
}
